<html>
<head><meta charset="utf-8"><title>prevent MIR inliner cycles · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html">prevent MIR inliner cycles</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="187270537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187270537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187270537">(Feb 03 2020 at 15:13)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> I have a checkout open working on it</p>



<a name="187270550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187270550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187270550">(Feb 03 2020 at 15:13)</a>:</h4>
<p>working on what?</p>



<a name="187270554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187270554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187270554">(Feb 03 2020 at 15:13)</a>:</h4>
<p>the protoype is quite invasive though</p>



<a name="187270618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187270618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187270618">(Feb 03 2020 at 15:14)</a>:</h4>
<p>I'm working on a real solution on the "don't cause cycle errors in the inliner"</p>



<a name="187270637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187270637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187270637">(Feb 03 2020 at 15:14)</a>:</h4>
<p>if you mean the inliner, the problem is a design one, not implementation</p>



<a name="187270660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187270660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187270660">(Feb 03 2020 at 15:14)</a>:</h4>
<p>how so?</p>



<a name="187270688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187270688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187270688">(Feb 03 2020 at 15:15)</a>:</h4>
<p>cycles in the query engine are not sound</p>



<a name="187270725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187270725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187270725">(Feb 03 2020 at 15:15)</a>:</h4>
<p>because for any non-trivial cycle, you have N "mutually recursive" queries, and depending which one is entered, the result of all of them will differ</p>



<a name="187271234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187271234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187271234">(Feb 03 2020 at 15:21)</a>:</h4>
<p>I'm not touching the query engine</p>



<a name="187271330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187271330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187271330">(Feb 03 2020 at 15:22)</a>:</h4>
<p>I think I have a solution completely side stepping any kind of issues</p>



<a name="187271341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187271341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187271341">(Feb 03 2020 at 15:22)</a>:</h4>
<p>I kind of doubt it, given everything I've heard about this before</p>



<a name="187271394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187271394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187271394">(Feb 03 2020 at 15:23)</a>:</h4>
<p>so talk to <span class="user-mention" data-user-id="124287">@mw</span> and <span class="user-mention" data-user-id="116009">@nikomatsakis</span> (to be clear, I want to be impressed :P)</p>



<a name="187271401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187271401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187271401">(Feb 03 2020 at 15:23)</a>:</h4>
<p>I'm not saying it is a cheap or good solution, but a PoC giving us a starting point</p>



<a name="187273956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187273956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187273956">(Feb 03 2020 at 15:48)</a>:</h4>
<blockquote>
<p>you have to be kidding me... it's sensitive to the declaration order?!</p>
</blockquote>
<p>Yes. You have no idea how many times I've done this exact thing trying to get the inliner to trigger only for the declaration order to be what's preventing it.</p>



<a name="187274165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187274165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187274165">(Feb 03 2020 at 15:51)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> I just mean that this is a known design problem with no solutions that we know of that work <em>at all</em></p>



<a name="187274230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187274230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187274230">(Feb 03 2020 at 15:51)</a>:</h4>
<p>Let me be on my "I solved this"-high for a bit longer :P rebasing rn</p>



<a name="187425191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187425191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187425191">(Feb 05 2020 at 04:45)</a>:</h4>
<p>well played oli, you showed me <a href="https://github.com/rust-lang/rust/pull/68828#issuecomment-582235377" target="_blank" title="https://github.com/rust-lang/rust/pull/68828#issuecomment-582235377">https://github.com/rust-lang/rust/pull/68828#issuecomment-582235377</a></p>



<a name="187425414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187425414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187425414">(Feb 05 2020 at 04:51)</a>:</h4>
<p>you (accidentally?) unblocked something that predates the query system and its cycle detection (and any way to catch such a cycle)</p>



<a name="187425601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187425601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187425601">(Feb 05 2020 at 04:57)</a>:</h4>
<p>I am in awe and also ashamed I told you anything discouraging</p>



<a name="187425650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187425650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187425650">(Feb 05 2020 at 04:58)</a>:</h4>
<p>but also I wish we could get the callers on optimized_mir just before inlining. do we just agree to put inlining first?</p>



<a name="187425668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187425668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187425668">(Feb 05 2020 at 04:58)</a>:</h4>
<p>that is, inlining seeing validated_mir just like the relevant queries</p>



<a name="187425677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187425677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187425677">(Feb 05 2020 at 04:59)</a>:</h4>
<p>(also feel free to split this topic somehow, it's getting all kinds of offtopicy)</p>



<a name="187429162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/prevent%20MIR%20inliner%20cycles/near/187429162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/prevent.20MIR.20inliner.20cycles.html#187429162">(Feb 05 2020 at 06:34)</a>:</h4>
<p>My scheme can be updated to work just before inlining by splitting the mir opt query, that just seemed too intrusive for me</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>